package com.rran.study.chat.server.accept;

import com.rran.study.chat.server.core.annotations.Accept;
import com.rran.study.chat.server.core.annotations.AcceptMapping;
import com.rran.study.chat.server.dto.request.RegisterMsg;
import com.rran.study.chat.server.dto.Response;
import com.rran.study.chat.server.service.UserService;
import io.netty.channel.ChannelHandlerContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;


/**
 * @author yy
 * @Type UserAccept.java
 * @Desc
 * @date 2020/8/9 16:16
 */
@Accept
@Component
@AcceptMapping(value = "/user")
public class UserAccept {

    @Autowired
    private UserService userService;

    /**
     * 注用户册连接
     *
     * @param msg
     * @param ctx
     */
    @AcceptMapping(value = "/register")
    public Response<String> register(RegisterMsg msg, ChannelHandlerContext ctx) {
        return userService.register(msg,ctx);
    }

}
